# -*- coding: utf-8 -*-
from django.db import models
from export.models import BaseProduct

attributesCode = ['name', 'price', 'special_price', 'status', 'owner', 'short_description', 'main_type', 'url_key',
                  'brand_name', 'image']

class Product(BaseProduct):
    price = models.DecimalField(max_digits=10, decimal_places=2)
    special_price = models.BooleanField()
    status = models.BooleanField()
    owner = models.CharField(max_length=50)
    main_type = models.CharField(max_length=100)
    url_key = models.URLField()
    image = models.URLField()

    def __unicode__(self):
        return self.name

    def getAttrByName(self, name):
        return self.__getattribute__(name)

    def setAttrByName(self, name, value):
        self.__setattr__(name, value)